#ifndef CAlexMakerH
#define CAlexMakerH
//---------------------------------------------------------------------------
#ifdef _PCKETAT_BPL
  #define PACKAGE_PCKETAT __declspec( dllexport)
#else
  #define PACKAGE_PCKETAT __declspec( dllimport)
#endif

#ifdef _MYSQL
  #include "ZConnect.hpp"
  #include "ZMySqlCon.hpp"
  #include "ZMySqlQuery.hpp"
  #include "ZMySqlTr.hpp"
  #include "ZQuery.hpp"
  #include "ZTransact.hpp"
  #include "ZMySqlQuery.hpp"
#endif

#include <db.hpp>
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <dialogs.hpp>
#include <dbtables.hpp>
#include <s:\packages\pcketat\EtatTypes.h>
#include <s:\packages\eic\EicDossi.h>

//---------------------------------------------------------------------------
class TFlux;

class EICCurrencyFmt;
class EICNumberFmt;
class TDocument;
class TEtat;
class TBande;
class TCpChamp;
class TCpTableau;
class TFrmVisualise;

class TDocUser;
class TEtatUser;
class TBandeUser;
class TCpChampUser;
class TCpTableauUser;
class EICStyle;
class EICListStyle;

void PACKAGE_PCKETAT __fastcall InitLstStyles( EICListStyle **pLstStylesModif, TDocUser *Doc, TMemoryStream* s);
void PACKAGE_PCKETAT __fastcall EnregistreLstStyles( EICListStyle **pLstStylesModif, TMemoryStream* s);
void PACKAGE_PCKETAT __fastcall AfficherStyles( TComponent* Owner, EICListStyle *pLstStyles);
void PACKAGE_PCKETAT __fastcall DetruireLstStylesModif( EICListStyle *pLstStylesModif);

typedef bool __fastcall (__closure *TOnDocEvent      )( TDocUser       *Doc);
typedef bool __fastcall (__closure *TOnEtatEvent     )( TEtatUser      *Etat);
typedef bool __fastcall (__closure *TOnBandeEvent    )( TBandeUser     *Bande);
typedef void __fastcall (__closure *TOnConstBandeEvent    )( const TBandeUser *Bande);
typedef bool __fastcall (__closure *TOnSQLParamsEvent)( const TEtatUser *Etat, TParams *Params);
typedef bool __fastcall (__closure *TOnBDInitializedEvent)( const TEtatUser *Etat, TDataSet *BaseDeDonnee/*TQuery ou TIBQuery*/);
typedef bool __fastcall (__closure *TOnChampEvent    )( TCpChampUser   *Champ);
typedef bool __fastcall (__closure *TOnTableauEvent  )( TCpTableauUser *Tableau);

class PACKAGE_PCKETAT TCpTableauUser : public TObject
{
private :
    TCpTableau     *m_CpTableau;
    const TBandeUser   *m_BandeProprietaire;
    bool   __fastcall GetVisible( short nCol)const;
    void   __fastcall SetVisible( short nCol, bool b);
    int    __fastcall GetLargeur( short nCol)const;
    void   __fastcall SetLargeur( short nCol, int n);
    int    __fastcall GetOrdreAffichage( short nCol)const;
    void   __fastcall SetOrdreAffichage( short nCol, int n);
    int    __fastcall GetLargeurMin( short nCol)const;
    void   __fastcall SetLargeurMin( short nCol, int n);
    int    __fastcall GetLargeurMax( short nCol)const;
    void   __fastcall SetLargeurMax( short nCol, int n);
    int    __fastcall GetNbCol( )const;
    AnsiString  __fastcall GetNom()const;


public  :
    virtual __fastcall ~TCpTableauUser( );
    __fastcall TCpTableauUser( TCpTableau* CpTableau);

    __property const TBandeUser* BandeProprietaire   = {read=m_BandeProprietaire};
    __property AnsiString        Nom         = {read=GetNom};
    __property bool              Visible[short nCol] = {read=GetVisible, write=SetVisible};
    __property int /* en DixMm*/ Largeur[short nCol] = {read=GetLargeur, write=SetLargeur};
    __property int /* en DixMm*/ LargMin[short nCol] = {read=GetLargeurMin, write=SetLargeurMin};
    __property int /* en DixMm*/ LargMax[short nCol] = {read=GetLargeurMax, write=SetLargeurMax};
    __property int               OrdreAffichage[short nCol] = {read=GetOrdreAffichage, write=SetOrdreAffichage};
    __property short             NbCol               = {read=GetNbCol};
};


class PACKAGE_PCKETAT TCpChampUser : public TObject
{
private :
    TCpChamp     *m_CpChamp;
    const TCpChamp     *m_ConstCpChamp;
    const TBandeUser   *m_BandeProprietaire;
    TFont        *m_Font;
    AnsiString  __fastcall GetNom()const;
    AnsiString  __fastcall GetChampDB()const;
    Variant     __fastcall GetValeur()const;
    void        __fastcall SetValeur( Variant Valeur);
    bool        __fastcall GetVisible()const;
    void        __fastcall SetVisible( bool bVisible);
    short       __fastcall GetNumColonneAttachee()const;
    void        __fastcall SetNumColonneAttachee( short n);
    short       __fastcall GetNbColonneAttachee()const;
    void        __fastcall SetNbColonneAttachee( short n);
    TFont*      __fastcall GetFont()const;
    void        __fastcall SetFont( const TFont *f);
    Text_Presentation  __fastcall GetAlignment()const;
    void               __fastcall SetAlignment( Text_Presentation a);
    TColor      __fastcall GetBkColor()const;
    void        __fastcall SetBkColor( TColor c);
    bool        __fastcall GetForceBkStyle()const;
    void        __fastcall SetForceBkStyle( bool b);
    TBrushStyle __fastcall GetBkStyle()const;
    void        __fastcall SetBkStyle( TBrushStyle c);
    Text_Format __fastcall GetTypeFormatage()const;
    void        __fastcall SetTypeFormatage( Text_Format f);
    int         __fastcall GetNumDigits()const;
    void        __fastcall SetNumDigits( int i);
    float       __fastcall GetBordureGauche()const;
    void        __fastcall SetBordureGauche( float f);
    float       __fastcall GetBordureHaute()const;
    void        __fastcall SetBordureHaute( float f);
    float       __fastcall GetBordureDroite()const;
    void        __fastcall SetBordureDroite( float f);
    float       __fastcall GetBordureBasse()const;
    void        __fastcall SetBordureBasse( float f);
    int         __fastcall GetNbUniteArrondies()const;
    void        __fastcall SetNbUniteArrondies( int i);
    int         __fastcall GetRetraitTexte()const;
    void        __fastcall SetRetraitTexte(int i);
    AnsiString  __fastcall GetStyle()const;
    void        __fastcall SetStyle(AnsiString s);
    int         __fastcall GetZeroSignificatif()const;
    void        __fastcall SetZeroSignificatif( int i);
    Type_Champ  __fastcall GetType()const;
    void        __fastcall SetType(Type_Champ t);
    AnsiString  __fastcall GetFormule()const;
    void        __fastcall SetFormule(AnsiString s);

public  :
    virtual __fastcall ~TCpChampUser( );
    __fastcall TCpChampUser( TCpChamp* CpChamp);
    __fastcall TCpChampUser( const TCpChamp* CpChamp);

    __property const TBandeUser* BandeProprietaire  = {read=m_BandeProprietaire};
    __property       AnsiString  Nom                = {read=GetNom};
    __property       AnsiString  ChampDB            = {read=GetChampDB};
    __property       Variant     Valeur             = {read=GetValeur,              write=SetValeur};
    __property       bool        Visible            = {read=GetVisible,             write=SetVisible};
    __property       short       NumColonneAttachee = {read=GetNumColonneAttachee,  write=SetNumColonneAttachee};
    __property       short       NbColonneAttachee  = {read=GetNbColonneAttachee,   write=SetNbColonneAttachee};
    __property       TFont*      Font               = {read=GetFont,                write=SetFont};
    __property       Text_Presentation  Alignment   = {read=GetAlignment,           write=SetAlignment};
    __property       TColor      BkColor            = {read=GetBkColor,             write=SetBkColor};
    __property       bool        ForceBkStyle       = {read=GetForceBkStyle,        write=SetForceBkStyle};
    __property       TBrushStyle BkStyle            = {read=GetBkStyle,             write=SetBkStyle};
    __property       Text_Format TypeFormatage      = {read=GetTypeFormatage,       write=SetTypeFormatage};
    __property       int         NumDigits          = {read=GetNumDigits,           write=SetNumDigits};
    __property       float       BordureGauche      = {read=GetBordureGauche,       write=SetBordureGauche};
    __property       float       BordureHaute       = {read=GetBordureHaute,        write=SetBordureHaute};
    __property       float       BordureDroite      = {read=GetBordureDroite,       write=SetBordureDroite};
    __property       float       BordureBasse       = {read=GetBordureBasse,        write=SetBordureBasse};
    __property       int         NbUniteArrondies   = {read=GetNbUniteArrondies,    write=SetNbUniteArrondies}; //permet par exemple de fixer en k€ en passant à 3
    __property       int         RetraitTexte       = {read=GetRetraitTexte,        write=SetRetraitTexte};
    __property       AnsiString  Style              = {read=GetStyle,               write=SetStyle};
    __property       int         ZeroSignificatif   = {read=GetZeroSignificatif,    write=SetZeroSignificatif}; //permet par exemple de fixer en k€ en passant à 3
    __property       Type_Champ  Type               = { read=GetType,               write=SetType};
    __property       AnsiString  Formule            = { read=GetFormule,            write=SetFormule};
    void __fastcall GetAdresse( AnsiString &Denomination, ADRESSE_TDFC &adr)const;
    void __fastcall SetAdresse( const AnsiString &Denomination, const ADRESSE_TDFC &adr);
};

class PACKAGE_PCKETAT TBandeUser : public TObject
{
private :
    TBande          *m_Bande;
    const TBande    *m_BandeConst;
    TCpChampUser    *Cp;
    TCpTableauUser  *CpTab;
    const TEtatUser *m_EtatProprietaire;

    AnsiString __fastcall GetTitre()const;
    AnsiString __fastcall GetChampRupture()const;
    AnsiString __fastcall GetValeurChampRupture()const;
    bool       __fastcall GetSautDePageAvant()const;
    void       __fastcall SetSautDePageAvant(bool b);
    bool       __fastcall GetSautDePageApres()const;
    void       __fastcall SetSautDePageApres(bool b);
    int        __fastcall GetNumBandeUtilPrecedente()const;
    void       __fastcall SetNumBandeUtilPrecedente(int b);
    int        __fastcall GetNumBandeUtilSuivante()const;
    void       __fastcall SetNumBandeUtilSuivante(int b);
    bool       __fastcall GetPremiereBandeDetail()const;
    bool       __fastcall GetAutoLoop()const;
    void       __fastcall SetAutoLoop(bool b);
    AnsiString __fastcall GetEtatAImprimerApres()const;
    void       __fastcall SetEtatAImprimerApres(const AnsiString &s);
    int        __fastcall GetIndiceRepetition()const;
    int        __fastcall GetHauteurDispoApres()const;
    int        __fastcall GetHauteurDispoApres2()const;
    TYPE_BANDE __fastcall GetTypeBande()const;
    int        __fastcall GetNumBandeUtil()const;
    int        __fastcall GetHaut()const;
    void       __fastcall SetHaut(int h);
    int        __fastcall GetHauteur()const;
    void       __fastcall SetHauteur(int h);
    bool       __fastcall GetPrisDansCalculColonne()const;
    void       __fastcall SetPrisDansCalculColonne(bool b);
    int        __fastcall GetNumeroDeLaBandeDansLaPage()const;
    WORD       __fastcall GetNiveau()const;

public  :
    __fastcall TBandeUser( TBande* bande);
    __fastcall TBandeUser( const TBande* bande);
    virtual __fastcall ~TBandeUser( );

    TCpChampUser* __fastcall GetChamp(const AnsiString &Nom)const;
    TCpTableauUser* __fastcall GetTableau(const AnsiString &Nom)const;
    __property AnsiString       Titre               = {read=GetTitre};
    __property AnsiString       ChampRupture        = {read=GetChampRupture};
    __property AnsiString       ValeurChampRupture  = {read=GetValeurChampRupture};
    __property bool             SautDePageAvant     = {read=GetSautDePageAvant, write=SetSautDePageAvant};
    __property bool             SautDePageApres     = {read=GetSautDePageApres, write=SetSautDePageApres};
    __property int              NumBandeUtilPrecedente= {read=GetNumBandeUtilPrecedente,write=SetNumBandeUtilPrecedente};
    __property int              NumBandeUtilSuivante= {read=GetNumBandeUtilSuivante,write=SetNumBandeUtilSuivante};
    __property bool             PremiereBandeDetail = {read=GetPremiereBandeDetail};
    __property const TEtatUser *EtatProprietaire    = {read=m_EtatProprietaire};
    __property bool             AutoLoop            = {read=GetAutoLoop, write=SetAutoLoop};
    __property AnsiString       EtatAImprimerApres  = {read=GetEtatAImprimerApres, write=SetEtatAImprimerApres};
    __property int              IndiceRepetition    = {read=GetIndiceRepetition};
    __property int /*en DixMm*/ HauteurDispoApres   = {read=GetHauteurDispoApres};
    __property int /*en DixMm*/ HauteurDispoApres2  = {read=GetHauteurDispoApres2};
    __property TYPE_BANDE       TypeBande           = {read=GetTypeBande};
    __property int              NumBandeUtil        = {read=GetNumBandeUtil};
    __property int              Haut                = {read=GetHaut, write=SetHaut};
    __property int              Hauteur             = {read=GetHauteur, write=SetHauteur};
    __property bool             PrisDansCalculColonne = {read=GetPrisDansCalculColonne, write=SetPrisDansCalculColonne};
    __property int              NumeroDeLaBandeDansLaPage = {read=GetNumeroDeLaBandeDansLaPage}; // ne prend pas en compte l'entete eventuel
    __property WORD             Niveau             = {read=GetNiveau};
};

class PACKAGE_PCKETAT TEtatUser : public TObject
{
private :
    TEtat *m_Etat;
    const TEtat *m_ConstEtat;
    TBandeUser *m_Bd;
    TStringList *m_Lst;
    AnsiString __fastcall GetSQL()const;
    int        __fastcall GetNombreDePages()const;
    int        __fastcall GetPageCourante()const;
    AnsiString __fastcall GetTitre()const;
    short      __fastcall GetNbCopies()const;
    short      __fastcall GetNumero()const;
    long       __fastcall GetNbEnreg()const;
    bool       __fastcall GetPortrait( )const;
    int        __fastcall GetTag( )const;

    void       __fastcall SetSQL( const AnsiString& SQL);
    void       __fastcall SetNombreDePages( int n);
    void       __fastcall SetPageCourante( int n);
    void       __fastcall SetTitre( const AnsiString& t);
    void       __fastcall SetNbCopies( short n);
    void       __fastcall SetRuptures( TStringList *Lst);
    void       __fastcall SetPortrait( bool b);
    void       __fastcall SetTag( int i);
    void       __fastcall OnChangeLstRupture(System::TObject* Sender);
//    TNotifyEvent          OnChangeLstRupture;
    int        __fastcall GetLargeur( );
    TDataSet*  __fastcall GetBaseDeDonnee( ) const; /*TQuery ou TIBQuery*/
    bool       __fastcall GetCalculNbPages( )const;
    bool       __fastcall GetReinitBDDApresCalculsPage()const;
    void       __fastcall SetReinitBDDApresCalculsPage(bool b);
    enum type_debutpage __fastcall TEtatUser::GetDebutPage( )const;
    void       __fastcall SetDebutPage( enum type_debutpage i);
    const TDocUser       *m_DocProprietaire;
    EICCurrencyFmt* __fastcall  GetFormatCurDefaut( )const;
    void            __fastcall  SetFormatCurDefaut( EICCurrencyFmt* f);
    int             __fastcall  GetEspaceApres( )const;
    void            __fastcall  SetEspaceApres( int f);
    bool            __fastcall GetForcerMonetaireSaufZeroSignificatif()const;
    void            __fastcall SetForcerMonetaireSaufZeroSignificatif(bool b);
    int             __fastcall  GetHauteurCpOLE()const;
    int             __fastcall  GetInclusDansUnEtat()const;
    AnsiString      __fastcall GetFiligrane()const;
    void            __fastcall SetFiligrane(const AnsiString &b);
    AnsiString      __fastcall GetBD_User()const;
    void            __fastcall SetBD_User(const AnsiString &b);
    AnsiString      __fastcall GetBD_Password()const;
    void            __fastcall SetBD_Password(const AnsiString &b);
    AnsiString      __fastcall GetDatabaseName()const;
    void            __fastcall SetDatabaseName(const AnsiString &b);
    AnsiString      __fastcall GetImageFond()const;
    void            __fastcall SetImageFond(const AnsiString &b);
    bool            __fastcall GetReportRuptureHautPg()const;
    void            __fastcall SetReportRuptureHautPg(bool b);
    AnsiString      __fastcall GetGED_Criteres()const;
    void            __fastcall SetGED_Criteres(const AnsiString &b);
    AnsiString      __fastcall GetNomDocGED()const;
    void            __fastcall SetNomDocGED(const AnsiString &b);
    #ifdef _MYSQL
        TZZMySqlQuery*    __fastcall GetMySqlQuery()const;
        void              __fastcall SetMySqlQuery(TZZMySqlQuery *Query);
    #endif
    bool            __fastcall GetVersPDF()const;
    void            __fastcall SetVersPDF(const bool &b);


public  :
    __fastcall TEtatUser( TEtat* Etat);
    __fastcall TEtatUser( const TEtat* Etat);
    virtual __fastcall ~TEtatUser( );

    AnsiString __fastcall GetChampDB(const AnsiString &Nom)const;
    TBandeUser* __fastcall GetBande(TYPE_BANDE pType, WORD pNiveau)const;

    __property AnsiString      SQL                   = {read=GetSQL,           write= SetSQL};
    __property int             NombreDePage          = {read=GetNombreDePages, write= SetNombreDePages};
    __property int             PageCourante          = {read=GetPageCourante,  write= SetPageCourante};
    __property short           NbCopies              = {read=GetNbCopies,      write= SetNbCopies};
    __property const TDocUser *DocProprietaire       = {read=m_DocProprietaire};
    __property AnsiString      Titre                 = {read=GetTitre,         write= SetTitre};
    __property TStringList    *LstRuptures           = {read=m_Lst,            write= SetRuptures}; // fixer l'objet à true pour rendre la rupture inactive
    __property short           Numero                = {read=GetNumero};
    __property long            NbEnreg               = {read=GetNbEnreg};
    __property bool            Portrait              = {read=GetPortrait,      write= SetPortrait};
    __property int             Largeur               = {read=GetLargeur};
    __property AnsiString      BD_User               = {read=GetBD_User,       write= SetBD_User};
    __property AnsiString      BD_Password           = {read=GetBD_Password,   write= SetBD_Password};
    #ifdef _MYSQL
        __property TZZMySqlQuery     *MySqlQuery     = {read=GetMySqlQuery,    write = SetMySqlQuery};
    #endif
    __property AnsiString      DatabaseName          = {read=GetDatabaseName,  write= SetDatabaseName};
    __property TDataSet       *BaseDeDonnee          = {read=GetBaseDeDonnee}; /*TQuery ou TIBQuery*/
    __property int             Tag                   = {read=GetTag,           write=SetTag};
    __property type_debutpage  DebutPage             = {read=GetDebutPage,     write= SetDebutPage};
    __property bool            CalculNbPages         = {read=GetCalculNbPages};
    __property bool            ReinitBDDApresCalculsPage={read=GetReinitBDDApresCalculsPage,write=SetReinitBDDApresCalculsPage};
    __property EICCurrencyFmt *FormatCurDefaut       = {read=GetFormatCurDefaut, write=SetFormatCurDefaut};
    __property int             EspaceApres           = {read=GetEspaceApres,   write=SetEspaceApres};
    __property bool            ForcerMonetaireSaufZeroSignificatif = {read=GetForcerMonetaireSaufZeroSignificatif,   write=SetForcerMonetaireSaufZeroSignificatif};
    __property int             HauteurCpOLE          = {read=GetHauteurCpOLE};
    __property short           InclusDansUnEtat      = {read=GetInclusDansUnEtat}; // renvoie le numéro de cet etat ou -1 si pas inclus
    __property AnsiString      Filigrane             = {read=GetFiligrane,     write=SetFiligrane};
    __property AnsiString      ImageFond             = {read=GetImageFond,     write=SetImageFond};
    __property bool            ReportRuptureHautPg   = {read=GetReportRuptureHautPg,  write= SetReportRuptureHautPg};
    __property AnsiString      GED_Criteres          = {read=GetGED_Criteres,         write= SetGED_Criteres};  //"\"Armoire\",\"Rayon\",\"Classeur\",\"Dossier\""
    __property AnsiString      NomDocGED             = {read=GetNomDocGED,            write= SetNomDocGED};
    __property bool            VersPDF               = {read=GetVersPDF,              write= SetVersPDF};
};

class PACKAGE_PCKETAT TDocUser : public TObject
{
private :
    TDocument* m_Doc;
    int        nNumero;

    TFont*          __fastcall  GetFontDefaut( )const;
    TColor          __fastcall  GetColorDefaut( )const;
    EICCurrencyFmt* __fastcall  GetFormatCurDefaut( )const;
    EICNumberFmt*   __fastcall  GetFormatNumDefaut( )const;
    AnsiString      __fastcall  GetTitre()const;
    int             __fastcall  GetNumero()const;

    void            __fastcall  SetFontDefaut( TFont* f);
    void            __fastcall  SetColorDefaut( TColor c);
    void            __fastcall  SetFormatCurDefaut( EICCurrencyFmt* f);
    void            __fastcall  SetFormatNumDefaut( EICNumberFmt* f);
    void            __fastcall  SetTitre( const AnsiString& t);
    bool            __fastcall  GetInverserMargesSurPagePaire()const;
    void            __fastcall  SetInverserMargesSurPagePaire( bool b);
    int             __fastcall  GetHauteur( );
    void            __fastcall  SetHauteur(int);
    int             __fastcall  GetLargeur( );
    void            __fastcall  SetLargeur(int);

public  :
    __fastcall TDocUser( TDocument* Doc):TObject(){ m_Doc = Doc;};
    void __fastcall GetLstStylesDoc( EICListStyle **pLstStyles);
    void __fastcall SetLstStylesDoc( EICListStyle  *pLstStyles);

    __property   TFont          *FontDefaut      = { read=GetFontDefaut,      write=SetFontDefaut};
    __property   TColor          ColorDefaut     = { read=GetColorDefaut,     write=SetColorDefaut};
    __property   EICCurrencyFmt *FormatCurDefaut = { read=GetFormatCurDefaut, write=SetFormatCurDefaut};
    __property   EICNumberFmt   *FormatNumDefaut = { read=GetFormatNumDefaut, write=SetFormatNumDefaut};
    __property   AnsiString      Titre           = { read=GetTitre,           write=SetTitre};
    __property   int             Numero          = { read=GetNumero};
    __property   bool            InverserMargesSurPagePaire = { read=GetInverserMargesSurPagePaire, write=SetInverserMargesSurPagePaire};
    __property   int             Hauteur         = {read=GetHauteur, write=SetHauteur}; //Hauteur en dixième de mm
    __property   int             Largeur         = {read=GetLargeur, write=SetLargeur}; //Largeur en dixième de mm

};

enum TYPE_IMPRESSION{
    ti_Visu,
    ti_Imprimante,
    ti_PDF,
    ti_GED
};
class PACKAGE_PCKETAT CAlexMaker : public TComponent
{
private:
    typedef TComponent inherited;

    TComponent     *m_Owner;
    AnsiString      m_VisuName;
    TStrings       *m_DocNameList;
    bool            m_WantColor;
    bool            m_WantProgress;
    bool            m_WantChoixImprimante;
    short           m_NbCopies;
    bool            m_ShowNbCopies;
    bool            m_ImpressionRonde;
    TYPE_IMPRESSION m_TypeImpr;
    AnsiString      m_SessionName;
    unsigned short  m_MargeGaucheMm, m_MargeHautMm, m_MargeDroitMm, m_MargeBasMm;
    unsigned short  m_MargeHorsEnteteMm, m_MargeHorsPiedMm;
    TFrmVisualise   *m_Visu;
    int             m_Langue;
    bool            m_bPrepareLaVisu, m_PDFInactif;
    TStringList *DocumentsCharges;

    bool __fastcall OnDebutDocInterne(   TDocument  *Doc);
    bool __fastcall OnDebutEtatInterne(  TEtat      *Etat);
    bool __fastcall OnSQLParamsInterne(  TEtat      *Etat, TParams *SQLParams);
    bool __fastcall OnBDInitializedInterne( TEtat   *Etat);
    bool __fastcall OnFirstBandeEtatInterne(TBande     *Bande);
    bool __fastcall OnBandeInterne(      TBande     *Bande);
    void __fastcall OnAfterFirstBandeInitInterne( const TBande     *Bande);
    bool __fastcall OnChampInterne(      TCpChamp   *Champ);
    bool __fastcall OnTableauInterne(    TCpTableau *Tableau);
    bool __fastcall OnFinEtatInterne(    TEtat      *Etat);
    bool __fastcall OnFinDocInterne(     TDocument  *Doc);
    void __fastcall OnParamVisu(         int &NbCopies);
    void __fastcall OnErrorInterne(const TObject* o, const AnsiString &Message);
    bool __fastcall OnVariableInterne(const TObject* o, const AnsiString &Variable, TFieldType &Type, AnsiString &Valeur);
    void __fastcall SetDocNameList         (TStrings     *pValue);

    TOnSQLParamsEvent  f_OnSQLParams;
    TOnBDInitializedEvent f_OnBDInitialized;

    TOnDocEvent        f_OnStartDoc;
    TOnDocEvent        f_OnEndDoc;

    TOnEtatEvent       f_OnStartEtat;
    TOnEtatEvent       f_OnEndEtat;

    TOnBandeEvent      f_OnFirstBandeEtat;
    TOnBandeEvent      f_OnFirstPageFooter;
    TOnBandeEvent      f_OnFirstPageHeader;
    TOnBandeEvent      f_OnPageFooter;
    TOnBandeEvent      f_OnPageHeader;

    TOnBandeEvent      f_OnBandeDebut;
    TOnBandeEvent      f_OnBandeDebutSection;
    TOnBandeEvent      f_OnBandeDebutColonne;
    TOnBandeEvent      f_OnBandeReportDebutDePage;
    TOnBandeEvent      f_OnBandeDetail;
    TOnBandeEvent      f_OnBandeUtilisateur;
    TOnBandeEvent      f_OnBandeReportFinDePage;
    TOnBandeEvent      f_OnBandeFinColonne;
    TOnBandeEvent      f_OnBandeFinSection;
    TOnBandeEvent      f_OnBandeFin;
    TOnConstBandeEvent f_OnAfterFirstBandeInit;
    TOnBandeEvent      f_OnSautDePage;
    TOnErrorEvent      f_OnErreur;
    TOnVariableEvent   f_OnVariable;

    TOnChampEvent      f_OnChamp;
    TOnTableauEvent    f_OnTableau;

    void         __fastcall Init          ( );
    void         __fastcall DeInit        ( );
    bool         __fastcall Show          ( TYPE_IMPRESSION TypeImpr, enum TPrintRange printRange, int nPageDebut, int nPageFin);
    bool         __fastcall GetImpressionFaite();
    void         __fastcall SetLangue( int i);
protected:

public:
    virtual __fastcall ~CAlexMaker();
    __fastcall CAlexMaker(TComponent* Owner);
    bool         __fastcall Preview        ( );
    bool         __fastcall Print          ( enum TPrintRange printRange = prAllPages, int nPageDebut=0, int nPageFin=0);
    bool         __fastcall PrintPdf       ( const AnsiString &File);
    bool         __fastcall PrintGED       ( );
    __property bool               ImpressionFaite       = { read=GetImpressionFaite};
    void         __fastcall AjouteEtat( const AnsiString &DocFile, const AnsiString &EtatName, unsigned long Tag = NO_TAG, CAlexMaker *pAM=NULL);
    int          __fastcall AjouteEtatNbPages( const AnsiString &DocFile, const AnsiString &EtatName, unsigned long Tag = NO_TAG, CAlexMaker *pAM=NULL);
    void         __fastcall AjouteEtatOLE( const AnsiString &OLEFile, bool Resize = true, bool ImprimeEnteteEtPied = true, unsigned long Tag = NO_TAG, CAlexMaker *pAM = NULL);
    void         __fastcall ClearEtats( );
    __property unsigned short     MargeGaucheMm         = { read=m_MargeGaucheMm        , write=m_MargeGaucheMm};
    __property unsigned short     MargeHautMm           = { read=m_MargeHautMm          , write=m_MargeHautMm  };
    __property unsigned short     MargeDroitMm          = { read=m_MargeDroitMm         , write=m_MargeDroitMm };
    __property unsigned short     MargeBasMm            = { read=m_MargeBasMm           , write=m_MargeBasMm   };
    __property unsigned short     MargeHorsEnteteMm     = { read=m_MargeHorsEnteteMm    , write=m_MargeHorsEnteteMm };
    __property unsigned short     MargeHorsPiedMm       = { read=m_MargeHorsPiedMm      , write=m_MargeHorsPiedMm   };

__published:
    __property AnsiString         VisuName              = { read=m_VisuName             , write=m_VisuName                                  };
    __property TStrings          *DocList               = { read=m_DocNameList          , write=SetDocNameList                              };
    __property bool               WantColor             = { read=m_WantColor            , write=m_WantColor                 , default=false };
    __property bool               WantProgress          = { read=m_WantProgress         , write=m_WantProgress              , default=true  };
    __property bool               WantChoixImprimante   = { read=m_WantChoixImprimante  , write=m_WantChoixImprimante       , default=true  };
    __property short              NbCopies              = { read=m_NbCopies             , write=m_NbCopies                  , default=1     };
    __property bool               ShowNbCopies          = { read=m_ShowNbCopies         , write=m_ShowNbCopies              , default=true  };
    __property bool               ImpressionRonde       = { read=m_ImpressionRonde      , write=m_ImpressionRonde           , stored=false  };
    __property AnsiString         SessionName           = { read=m_SessionName          , write=m_SessionName                               };
    __property int                Langue                = { read=m_Langue               , write=SetLangue                   , default=0     };
    __property bool               PrepareLaVisu         = { read=m_bPrepareLaVisu       , write=m_bPrepareLaVisu            , default=false };
    __property bool               PDFInactif            = { read=m_PDFInactif           , write=m_PDFInactif                , default=false };

    __property TOnSQLParamsEvent        OnSQLParamsEvent        = { read=f_OnSQLParams          , write=f_OnSQLParams       , default = NULL};
    __property TOnBDInitializedEvent    OnBDInitializedEvent    = { read=f_OnBDInitialized      , write=f_OnBDInitialized   , default = NULL};

    __property TOnDocEvent        OnStartDocEvent       = { read=f_OnStartDoc           , write=f_OnStartDoc                , default = NULL};
    __property TOnDocEvent        OnEndDocEvent         = { read=f_OnEndDoc             , write=f_OnEndDoc                  , default = NULL};

    __property TOnEtatEvent       OnStartEtatEvent      = { read=f_OnStartEtat          , write=f_OnStartEtat               , default = NULL};
    __property TOnEtatEvent       OnEndEtatEvent        = { read=f_OnEndEtat            , write=f_OnEndEtat                 , default = NULL};

    __property TOnBandeEvent      OnFirstBandeEtat      = { read=f_OnFirstBandeEtat     , write=f_OnFirstBandeEtat          , default = NULL};

    __property TOnBandeEvent      OnFirstPageFooter     = { read=f_OnFirstPageFooter    , write=f_OnFirstPageFooter         , default = NULL};
    __property TOnBandeEvent      OnFirstPageHeader     = { read=f_OnFirstPageHeader    , write=f_OnFirstPageHeader         , default = NULL};
    __property TOnBandeEvent      OnPageFooter          = { read=f_OnPageFooter         , write=f_OnPageFooter              , default = NULL};
    __property TOnBandeEvent      OnPageHeader          = { read=f_OnPageHeader         , write=f_OnPageHeader              , default = NULL};

    __property TOnBandeEvent      OnBandeDebut          = { read=f_OnBandeDebut         , write=f_OnBandeDebut              , default = NULL};
    __property TOnBandeEvent      OnBandeDebutSection   = { read=f_OnBandeDebutSection  , write=f_OnBandeDebutSection       , default = NULL};
    __property TOnBandeEvent      OnBandeDebutColonne   = { read=f_OnBandeDebutColonne  , write=f_OnBandeDebutColonne       , default = NULL};
    __property TOnBandeEvent   OnBandeReportDebutDePage = { read=f_OnBandeReportDebutDePage , write=f_OnBandeReportDebutDePage   , default = NULL};
    __property TOnBandeEvent      OnBandeDetail         = { read=f_OnBandeDetail        , write=f_OnBandeDetail             , default = NULL};
    __property TOnBandeEvent      OnBandeUtilisateur    = { read=f_OnBandeUtilisateur   , write=f_OnBandeUtilisateur        , default = NULL};
    __property TOnBandeEvent     OnBandeReportFinDePage = { read=f_OnBandeReportFinDePage , write=f_OnBandeReportFinDePage  , default = NULL };
    __property TOnBandeEvent      OnBandeFinColonne     = { read=f_OnBandeFinColonne    , write=f_OnBandeFinColonne         , default = NULL};
    __property TOnBandeEvent      OnBandeFinSection     = { read=f_OnBandeFinSection    , write=f_OnBandeFinSection         , default = NULL};
    __property TOnBandeEvent      OnBandeFin            = { read=f_OnBandeFin           , write=f_OnBandeFin                , default = NULL};
    __property TOnConstBandeEvent OnAfterFirstBandeInit      = { read=f_OnAfterFirstBandeInit     , write=f_OnAfterFirstBandeInit  , default = NULL};
    __property TOnBandeEvent      OnSautDePage          = { read=f_OnSautDePage         , write=f_OnSautDePage              , default = NULL};

    __property TOnChampEvent      OnChamp               = { read=f_OnChamp              , write=f_OnChamp                   , default = NULL};
    __property TOnTableauEvent    OnTableau             = { read=f_OnTableau            , write=f_OnTableau                 , default = NULL};

    __property TOnErrorEvent      OnErreur              = { read=f_OnErreur             , write=f_OnErreur                  , default = NULL};
    __property TOnVariableEvent   OnVariable            = { read=f_OnVariable           , write=f_OnVariable                , default = NULL};

};
//---------------------------------------------------------------------------
typedef bool __fastcall (*TYPE_AJOUTE_ETAT)( int NumEtat, CAlexMaker *CAM, bool bAfficheVide, enum type_debutpage, void *UserData,const AnsiString &NomDocGED,const AnsiString &asNomClassementGED);

#ifdef _DEBUG
  #define AJOUTE_ETAT(CAM_DESTINATION,CAM_SOURCE,DOCUMENT,ETAT,CHEMIN_INFORMATICIEN) if (IS_MACHINE_INFORMATICIEN()) \
                                                                                       CAM_DESTINATION->AjouteEtat(IncludeTrailingBackslash(CHEMIN_INFORMATICIEN) + DOCUMENT,ETAT,NO_TAG,CAM_SOURCE); \
                                                                                     else \
                                                                                       CAM_DESTINATION->AjouteEtat(DOCUMENT,ETAT,NO_TAG,CAM_SOURCE)
#else
  #define AJOUTE_ETAT(CAM_DESTINATION,CAM_SOURCE,DOCUMENT,ETAT,CHEMIN_INFORMATICIEN) CAM_DESTINATION->AjouteEtat(DOCUMENT,ETAT,NO_TAG,CAM_SOURCE)
#endif


extern PACKAGE_PCKETAT bool       gVersionDeDemonstration;
extern PACKAGE_PCKETAT bool       gGestionEnvoiGED;
extern PACKAGE_PCKETAT bool       gImpressionGroupeeGED;
#endif
